Flutter 初回の画面レイアウト後に何かする package
library after_layout;
import 'dart:async';
import 'package:flutter/widgets.dart';
mixin AfterLayoutMixin<T extends StatefulWidget> on State<T> {
@override
void initState() {
super.initState();
WidgetsBinding.instance.endOfFrame.then(
(_) {
if (mounted) afterFirstLayout(context);
},
);
}
FutureOr<void> afterFirstLayout(BuildContext context);
}
研修で作った: [Issue-#5] 画面表示状態に応じて処理が可能な AfterLayoutMixin
を追加 by daichikuwa0618 · Pull Request #17 · daichikuwa0618/flutter-weather-app